package com.dingjian.broker.enums;

/**
 * 国籍
 * 
 * @author google
 *
 */
public enum CountryEnum {
	MAINLAND("MAINLAND","大陆"), //大陆
	HONGKONG("HONGKONG","香港"),  //香港
	OVERSEA("OVERSEA","海外"),  //海外
	TAIWAN("TAIWAN","台湾"),  //台湾
	AOMEN("AOMEN","澳门"); //澳门
	
	private CountryEnum(){
		
	}
	private CountryEnum(String key,String description){
		this.key=key;
		this.description=description;
	}
	private String key;
	private String description;
	public String getKey() {
		return key;
	}
	public void setKey(String key) {
		this.key = key;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	
	/**
	 * 取枚举的json字符串
	 * @return
	 */
	public static String getJsonStr(){
		CountryEnum[] enums = CountryEnum.values();
		StringBuffer jsonStr = new StringBuffer("[");
		for (CountryEnum enumTemp : enums) {
			if(!"[".equals(jsonStr.toString())){
				jsonStr.append(",");
			}
			jsonStr.append("{id:'")
					.append(enumTemp.getKey())
					.append("',name:'")
					.append(enumTemp.getDescription())
					.append("',value:'")
					.append(enumTemp)
					.append("'}");
		}
		jsonStr.append("]");
		return jsonStr.toString();
	}
	
}
